<div class="layui-fluid layui-anim website-anim-up" id="website-class-apply-detail" lay-title="资格审查详情">
    <div class="layui-row layui-col-space8 website-container">
        <div class="layui-col-md10 layui-col-sm10 layui-col-xs10 layui-col-md-offset1">

            <div class="layui-card" id="client-user-info">
                <div class="layui-card-header">基本情况</div>
                <div class="layui-card-body layui-form-item">
                    <div class="layui-row">
                        <!-- 基本信息-->
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">课题名称：</div>
                            <div class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ? result.name
                                :''}]]
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">指南序号：</div>
                            <div id="topicCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ? result.topicCode
                                :''}]]
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">成果形式：</div>
                            <div id="achievementFormTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1 ">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">成果字数：</div>
                            <div class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ?
                                result.achievementFormSize :''}]] 万字
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">主持人姓名：</div>
                            <div class="layui-col-xs8 layui-col-sm8 layui-col-md7">[[${result != null ?
                                result.leader.name :''}]]
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3 ">
                                学科分类：
                            </div>
                            <div id="subjectTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>

                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">职称级别：</div>
                            <div id="titleTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">职称：</div>
                            <div  class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ?
                                result.leader.professionCode :''}]] </div>
                        </div>
                    </div>
                    <div class="layui-row more-add">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">性别：</div>
                            <div id="sexTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">民族：</div>
                            <div id="nationTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">证件类型：</div>
                            <div id="identityTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">出生日期：</div>
                            <div id="leaderBirthdayTime" class="layui-col-xs8 layui-col-sm8 layui-col-md8"></div>
                        </div>
                    </div>
                    <div class="layui-row more-add">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">证件号：</div>
                            <div class="layui-col-xs8 layui-col-sm8 layui-col-md7">[[${result != null ?
                                result.leader.identity :''}]]
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">研究类型：</div>
                            <div id="researchTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                    </div>
                    <div class="layui-row more-add">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">政治面貌：</div>
                            <div id="politicalTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">外语语种：</div>
                            <div id="language" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                    </div>
                    <div class="layui-row more-add">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">最终学位：</div>
                            <div id="degreeTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>

                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">担任导师：</div>
                            <div id="tutorTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">工作单位：</div>
                            <div class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ?
                                result.leader.company :''}]]
                            </div>

                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1 ">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">申报级别：</div>
                            <div id="levelTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                    </div>
                    <div class="layui-row more-add">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">通讯地址：</div>
                            <div class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ?
                                result.leader.address :''}]]
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">行政职务：</div>
                            <div id="positionTypeCode" class="layui-col-xs9 layui-col-sm9 layui-col-md9"></div>
                        </div>
                    </div>
                    <div class="layui-row more-add">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">邮政编码：</div>
                            <div class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ?
                                result.leader.postCode :''}]]
                            </div>
                        </div>

                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">电子邮箱：</div>
                            <div class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ?
                                result.leader.email :''}]]
                            </div>
                        </div>
                    </div>
                    <div class="layui-row more-add">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">联系电话：</div>
                            <div class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ?
                                result.leader.telephone :''}]]
                            </div>
                        </div>

                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs3 layui-col-sm3 layui-col-md3">手机号：</div>
                            <div class="layui-col-xs9 layui-col-sm9 layui-col-md9">[[${result != null ?
                                result.leader.mobile :''}]]
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-card more-add" id="client-class-member">
                <div class="layui-card-header">课题组人员</div>
                <div class="layui-card-body website-table-full">
                    <table id="classApplyMemberTable" lay-filter="classApplyMemberTable"
                           lay-data="{id: 'classApplyMemberTable'}"></table>
                </div>
            </div>
            <div class="layui-card more-add" id="client-class-project-info">
                <div class="layui-card-header">主持人曾经主持省部级以上社科研究项目及完成情况</div>
                <div class="layui-card-body website-table-full">
                    <table lay-filter="classApplyProjectInfoTable" id="classApplyProjectInfoTable"
                           lay-data="{id: 'classApplyProjectInfoTable'}"></table>
                </div>
            </div>
            <!--         研究基础和研究条件       -->
            <div class="layui-card more-add">
                <div class="layui-card-header">研究基础和研究条件</div>
                <div class="layui-card-body">
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md12">
                            <span>主持人近五年发表、出版的相关研究成果（注明刊物的年、期或出版社、出版日期）</span>
                            <textarea class="layui-textarea layui-disabled" name="leaderWorks5"
                                      autocomplete="off">[[${result != null ? result.leaderWorks5 :''}]]</textarea>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md12">
                            <span>课题组成员近3年发表、出版的与本课题有关的主要研究成果（注明刊物的年、期或出版社、出版日期）</span>
                            <textarea class="layui-textarea layui-disabled" name="memberWorks3"
                                      autocomplete="off">[[${result != null ? result.memberWorks3 :''}]]</textarea>

                        </div>
                    </div>
                </div>
            </div>
            <!-- 研究内容-->
            <div class="layui-card more-add" id="client-class-Solicit">
                <div class="layui-card-header">研究内容</div>
                <div class="layui-card-body">
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md12">
                            <span>主持人近五年发表、出版的相关研究成果（注明刊物的年、期或出版社、出版日期）</span>
                            <textarea class="layui-textarea layui-disabled" name="researchContent"
                                      autocomplete="off">[[${result != null ? result.researchContent :''}]]</textarea>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-card more-add" id="client-class-review-info">
                <div class="layui-card-header">审核记录</div>
                <div class="layui-card-body website-table-full">
                    <table lay-filter="classApplyReviewInfoTable" id="classApplyReviewInfoTable"
                           lay-data="{id: 'classApplyReviewInfoTable'}"></table>
                </div>
                <div id="checkFooter" class="layui-card-footer">
                    <button id="btnCheck" th:if="${result != null ? result.statusTypeCode :''} =='apply'" data-type="auto" class="layui-btn layui-btn-normal">审查</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="sex-type">
    {{#
    var dict=layui.dict.getByCode(d.sexTypeCode);
    }}
    {{#  if(dict){ }}
    <span>{{ dict.name }}</span>
    {{#  } }}
</script>
<script type="text/html" id="position-type">
    {{#
    var dict=layui.dict.getByCode(d.positionTypeCode);
    }}
    {{#  if(dict){ }}
    <span>{{ dict.name }}</span>
    {{#  } }}
</script>
<script type="text/html" id="title-type">
    {{#
    var dict=layui.dict.getByCode(d.titleTypeCode);
    }}
    {{#  if(dict){ }}
    <span>{{ dict.name }}</span>
    {{#  } }}
</script>
<script type="text/html" id="degree-type">
    {{#
    var dict=layui.dict.getByCode(d.degreeTypeCode);
    }}
    {{#  if(dict){ }}
    <span>{{ dict.name }}</span>
    {{#  } }}
</script>
<script type="text/html" id="identity-type">
    {{#
    var dict=layui.dict.getByCode(d.identityTypeCode);
    }}
    {{#  if(dict){ }}
    <span>{{ dict.name }}</span>
    {{#  } }}
</script>
<script type="text/html" id="finish-type">
    {{#  if(d.isFinish){ }}
    <span>是</span>
    {{#  } }}
    {{#  if(!d.isFinish){ }}
    <span>否</span>
    {{#  } }}
</script>
<script type="text/html" id="operator-type">
    {{#
    let dict=layui.dict.getByCode(d.operatorTypeCode);
    }}
    {{#  if(dict){ }}
    <span>{{ dict.name }}</span>
    {{#  } }}
</script>
<script type="text/html" id="status-type">
    {{#
    let dict=layui.dict.getByCode(d.statusTypeCode);
    }}
    {{#  if(dict){ }}
    <span>{{ dict.name }}</span>
    {{#  } }}
</script>
<script data-th-inline="javascript" type="text/javascript">
    layui.use(['dropdown', 'jquery', 'laydate', 'form', 'table', 'website', 'dict'], function () {
        var $ = layui.jquery,
            laydate = layui.laydate,
            website = layui.website,
            form = layui.form,
            table = layui.table,
            result = [[${result}]],
            $view = $('#website-class-apply-detail'),
            $btnCheck = $view.find('#btnCheck'),
            $projectView = $('#client-class-project-info'),
            $memberView = $('#client-class-member'),
            $reviewView = $('#client-class-review-info'),
            memberTableIns, ProjectInfoTableIns
        ;
        // 重新渲染 form否则不会显示下拉框
        form.render();

        initMemberTable();
        initProjectInfoTable();
        initReviewTable();


        function initProjectInfoTable() {
            ProjectInfoTableIns = website.table.init({
                elem: $projectView.find('table'),
                id: 'classApplyProjectInfoTable',
                url: ctx + result.declareId + '/leaderProject/list',
                cols: [
                    [
                        {type: 'numbers', title: '序号'},
                        {field: 'projectSource', title: '项目来源', minWidth: 100},
                        {field: 'type', title: '类别'},
                        {field: 'topicName', title: '课题名称', minWidth: 200},
                        {field: 'projectTime', title: '立项时间', minWidth: 165},
                        {templet: '#finish-type', title: '是否结项'}
                    ]
                ]
            });
        }

        function initMemberTable() {
            memberTableIns = website.table.init({
                elem: $memberView.find('table'),
                id: 'classApplyMemberTable',
                url: ctx + result.declareId + '/memberInfo/list',
                cols: [
                    [
                        {type: 'numbers', title: '序号'},
                        {field: 'name', title: '姓名', minWidth: 80},
                        {title: '性别', templet: '#sex-type'},
                        {field: 'birthday', title: '出生年月'},
                        {title: '职务', templet: '#position-type'},
                        {title: '职称级别', templet: '#title-type'},
                        {title: '职称', field: 'professionCode',},
                        {title: '最终学位', templet: '#degree-type'},
                        {field: 'field', title: '研究领域'},
                        {title: '证件类型', templet: '#identity-type', minWidth: 100},
                        {field: 'identity', title: '证件号', minWidth: 145},
                        {field: 'companyAddress', title: '工作单位', minWidth: 160},
                        {field: 'mobile', title: '联系电话'},
                        {field: 'email', title: '电子邮箱'}
                    ]
                ]
            });
        }

        $btnCheck.on('click', function () {
            website.modal.view('资格审查', 'biz/declareTopic/check/' + result.declareId, {
                area: $(window).width() <= 750 ? '95%' : '50%'
            });
        });
        initApplicantInfo()

        function initApplicantInfo() {
            if (result) {
                $("#achievementFormTypeCode").text(result.achievementFormTypeCode ? achievementFormTypeCodeName(result.achievementFormTypeCode) : '');
                $("#levelTypeCode").text(result.levelTypeCode ? layui.dict.getByCode(result.levelTypeCode).name : '');
                $("#subjectTypeCode").text(result.subjectTypeCode ? layui.dict.getByCode(result.subjectTypeCode).name : '');
                $("#researchTypeCode").text(result.researchTypeCode ? layui.dict.getByCode(result.researchTypeCode).name : '');
                $("#sexTypeCode").text(result.leader.sexTypeCode ? layui.dict.getByCode(result.leader.sexTypeCode).name : '');
                $("#positionTypeCode").text(result.leader.positionTypeCode ? layui.dict.getByCode(result.leader.positionTypeCode).name : '');
                $("#titleTypeCode").text(result.leader.titleTypeCode ? layui.dict.getByCode(result.leader.titleTypeCode).name : '');
                $("#nationTypeCode").text(result.leader.nationTypeCode ? layui.dict.getByCode(result.leader.nationTypeCode).name : '');
                $("#politicalTypeCode").text(result.leader.politicalTypeCode ? layui.dict.getByCode(result.leader.politicalTypeCode).name : '');
                $("#language").text(result.leader.language ? layui.dict.getByCode(result.leader.language).name : '');
                $("#degreeTypeCode").text(result.leader.degreeTypeCode ? layui.dict.getByCode(result.leader.degreeTypeCode).name : '');
                $("#tutorTypeCode").text(result.leader.tutorTypeCode ? layui.dict.getByCode(result.leader.tutorTypeCode).name : '');
                $("#identityTypeCode").text(result.leader.identityTypeCode ? layui.dict.getByCode(result.leader.identityTypeCode).name : '');
                $("#leaderBirthdayTime").text(result.leader.birthday ? layui.util.toDateString(result.leader.birthday, 'yyyy-MM-dd') : '');
            }
        }


        function achievementFormTypeCodeName(data) {
            var dicts = layui.dict.getByCodes(data.split(','))
            var name = ''
            for (var i = 0; i < dicts.length; i++) {
                name += dicts[i].name + ','
            }
            return name
        }

        function initReviewTable() {
            reviewTableIns = website.table.init({
                elem: $reviewView.find('table'),
                id: 'classApplyReviewInfoTable',
                url: ctx + 'logDeclareTopic/list',
                where: {
                    declareId: result.declareId
                },
                cols: [
                    [
                        {type: 'numbers', title: '序号'},
                        {templet: '#operator-type', title: '操作类型', minWidth: 80},
                        {field: 'operatorTime', title: '操作时间'},
                        {title: '审核结果', templet: '#status-type'},
                        {field: 'reason', title: '不合格原因'},
                    ]
                ]
            });
        }
    })


</script>